package cn.seecoder.courselearning.dto.question;
import cn.seecoder.courselearning.po.question.Question;
import cn.seecoder.courselearning.po.test.Submit;
import lombok.Data;
/**
 * 查看解析界面的题目DTO类
 */
@Data
public class QuestionWithAnalysisDTO {
    private Integer id;
    private Integer course_id;
    private String detail;
    private String optionA;
    private String optionB;
    private String optionC;
    private String optionD;
    private char answer;
    private char submit;
    private String resolution;
    private boolean is_right;

    public QuestionWithAnalysisDTO(Question question, Submit submit){
        this.id = question.getId();
        this.course_id = question.getCourse_id();
        this.detail = question.getDetail();
        this.optionA = question.getOptionA();
        this.optionB = question.getOptionB();
        this.optionC = question.getOptionC();
        this.optionD = question.getOptionD();
        this.answer = question.getAnswer();
        this.resolution = question.getResolution();

        this.submit = submit.getAns();
        this.is_right = (this.submit==this.answer);
    }
}
